-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
serve workflow templates from custom_nodes #6193
base: master
Are you sure you want to change the base?
serve workflow templates from custom_nodes #6193
Conversation
server.py
Outdated
@@ -250,6 +250,16 @@ async def get_extensions(request): | |||
name) + "/" + os.path.relpath(f, dir).replace("\\", "/"), files))) | |||
|
|||
return web.json_response(extensions) | |||
|
|||
@routes.get("/workflow_templates") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do have a plan to eventually move ComfyUI-Manager's custom node management features to core. Can we move this endpoint to a separate file app/custom_node_manager.py
?
server.py
Outdated
|
||
@routes.get("/workflow_templates") | ||
async def get_workflow_templates(request): | ||
files = glob.glob(os.path.join(folder_paths.custom_nodes_directory, '*/example_workflows/*.json')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can just call folder_paths.get_folder_paths("custom_nodes")
here instead of adding a new global variable in folder_paths
.
This PR prepares the following feature request: Comfy-Org/ComfyUI_frontend#1008
Related frontend PR: Comfy-Org/ComfyUI_frontend#2032
Implementation details:
@routes.get("/workflow_templates")
- This endpoint returns a map of custom_nodes names and their associated workflow template files. The ones without templates are omitted. Example:LOADED_MODULE_DIRS
where we keep track of all successfully loaded custom_nodes and their directories (even when there is no class mapping and web directory)custom_nodes/*/example_workflows/*
Question to reviewers:
/example_workflows
folders sufficient or shall we support existing folder structures of popular custom_node repos by allowing/examples
,/workflows
, etc.?